<%--
  Created by IntelliJ IDEA.
  User: 皇陆洋
  Date: 2021/11/19
  Time: 17:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <style>
        #box{
            position: relative;
            margin: 200px auto;
            border-radius: 20px;
            width: 400px;
            height: 300px;
            background-color: darkturquoise;
        }
        .a{
            width: 200px;
            height: 40px;
        }
        #box2{
            position: absolute;
            top: 210px;
            left: 70px;
        }
        #a{
            width: 260px;
        }
        table{
            position: absolute;
            left: 70px;
            top:70px;
        }
        p{
            position: absolute;
            top: -15px;
            right: 72px;
        }
    </style>
</head>
<body>

<%
    Cookie[] cookies = request.getCookies();
    if(cookies!=null){
        for (Cookie c : cookies){
            if("username".equals(c.getName())){
                pageContext.setAttribute("username",c.getValue());

            }
            if("password".equals(c.getName())){
                pageContext.setAttribute("password",c.getValue());
            }
        }
    }
%>
<div id="box">
<form action="hello">
    <table height="120px" align="center" cellspacing="0">
        <tr align="right">
            <td>账号：</td>
            <td><input type="text" name="username" value="${username}" class="a"></td>
        </tr>
        <tr align="right">
            <td>密码：</td>
            <td><input type="password" name="password" value="${password}" class="a"></td>
        </tr>
    </table>
    <div id="box2">
    <input type="checkbox" value="checkon" name="save" id=""
    <c:if test="${!empty username}">
            checked
    </c:if>
    >记住密码<p>没有账号？<a href="register.jsp">注册</a></p>
    <input type="submit" value="登录" class="a" id="a">
    </div>

</form>
</div>
</body>
</html>
